﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace PatientInformationExtract.Components
{
    public class MultiTypeValue
    {
        public MultiTypeValue()
        {
            SetValue(Command.FalseHidden);
        }

        public bool BooleanValue { get; set; }
        public Visibility VisibilityValue { get; set; }

        public bool SetValue(Command command)
        {
            switch (command)
            {
                case Command.FalseHidden:
                    {
                        this.BooleanValue = false;
                        this.VisibilityValue = Visibility.Hidden;
                        break;
                    }
                case Command.TrueVisible:
                    {
                        this.BooleanValue = true;
                        this.VisibilityValue = Visibility.Visible;
                        break;
                    }
                default:
                    {
                        return false;
                    }
            }
            return true;
        }

        public MultiTypeValue Reversal()
        {
            MultiTypeValue mtv = new MultiTypeValue();
            mtv.BooleanValue = !this.BooleanValue;
            if (this.VisibilityValue == Visibility.Visible)
            {
                mtv.VisibilityValue = Visibility.Hidden;
            }
            if (this.VisibilityValue == Visibility.Hidden)
            {
                mtv.VisibilityValue = Visibility.Visible;
            }
            return mtv;
        }

        public enum Command
        {
            TrueVisible,
            FalseHidden,
        }
    }
}
